home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MEMORY.SWG / 0065_DS and ES Registers.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-26  |  716b  |  35 lines

  1. {
  2.  ET> On entry in an assembler routine, I haven't (yet?) noticed a
  3.  ET> difference between the DS and ES registers. Can I rely on that??
  4.  
  5. No. You can assume ES to be uninitialized (ie, random value), and
  6. DS pointing to the program's data segment.
  7. Try this and see for yourself :-)
  8.  
  9. Note that if you change "b^:=a" to "a:=b^", DS and ES hold the same
  10. value when entering ShowESAndDS.
  11.  
  12. }
  13.  
  14. Var  a    : String ;
  15.      b    : ^String ;
  16.  
  17. Procedure ShowESAndDS ;
  18. Var  _ES,
  19.      _DS  : Word ;
  20. Begin
  21.      Asm
  22.           Mov  _ES, ES
  23.           Mov  _DS, DS
  24.      End ;
  25.      WriteLn('ES=', _ES, ', DS=', _DS) ;
  26. End ;
  27.  
  28. Begin
  29.      New(b) ;
  30.      b^:=a ;
  31.      ShowESAndDS ;
  32.      Dispose(b) ;
  33. End.
  34.  
  35.